﻿Public Class DataSetHasChanged
    'kiem tra xem co thay doi du lieu hay ko?

    Private Sub BacsiBindingNavigatorSaveItem_Click(sender As System.Object, e As System.EventArgs)
        Me.Validate()
        Me.BacsiBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.PcvgppDataSet)

    End Sub

    Private Sub DataSetHasChanged_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'PcvgppDataSet.bacsi' table. You can move, or remove it, as needed.
        Me.BacsiTableAdapter.Fill(Me.PcvgppDataSet.bacsi)

    End Sub

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Me.BacsiBindingSource.EndEdit()
    End Sub

    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
        If Me.PcvgppDataSet.HasChanges Then
            'neu co thay doi 
            MessageBox.Show("co thay doi roi !")
        Else
            'ko thay doi
            MessageBox.Show("khong thay doi gi ca  !")
        End If
    End Sub

    Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click
        'huy bo thay doi - cancel 
        Me.PcvgppDataSet.RejectChanges()
    End Sub
End Class